<!--#include file="_header.html"--> 
<!--#include file="includes/email_config.asp"-->
<%
if Request("action") = "send" Then
	Dim formValid, oFields, field, param, oParams
	formValid = true
	Set oParams = CreateObject("Scripting.Dictionary")
	Set oFields = CreateObject("Scripting.Dictionary")
	oFields("salutation2") = "Salutation"
	oFields("name") = "First Name"
	oFields("surname") = "Last Name"
	oFields("email") = "Email"
	oFields("countrycode2") = "Country"
	oFields("TypeOfMessage2") = "Type of Message"
	oFields("subject") = "Subject"
	oFields("message") = "Message"
	for each field in oFields
		if len(Request(field)) <= 0 then
			Response.Write("<script>alert('" & oFields(field) & " is required field');</script>")
			formValid = false
		end if
    next
    
    for each param in Request.Form
    	oParams(param) = Replace(Request(param), "'", "''")
    next
    if LCase(Request("cxCaptcha_edCaptcha")) <> LCase(Session("ASPCAPTCHA")) then
		Response.Write("<script>alert('Invalid Verification Code');</script>")
		formValid = false
	end if
	
	if formValid then
		Dim sql, rst, strTo, strFrom, strSubject, strBody
 
		Set rst = Server.CreateObject("ADODB.Recordset")
		
		sql = "INSERT INTO contact_us_messages " &_
			"SET DATE = '" & fc_str_date_server_format(Now(), 4) & "', "&_
			"SALUTATION = '" & oParams("salutation2") & "', " &_
			"FIRST_NAME = '" & oParams("name") & "', " &_
			"LAST_NAME = '" & oParams("surname") & "', " &_
			"EMAIL = '" & oParams("email") & "', " &_
			"ORGANISATION = '" & oParams("organization") & "', " &_
			"COUNTRYCODE = '" & oParams("countrycode2") & "', " &_
			"TYPE_OF_MESSAGE = '" & oParams("TypeOfMessage2") & "', " &_
			"SUBJECT = '" & oParams("subject") & "', " &_
			"QUESTION = '" & oParams("message") & "' "
		objConn.Execute sql
		
		sql = "SELECT EMAIL FROM notification_accounts WHERE CONTACT_US = 1"
		rst.Open sql, objConn

		Do While Not rst.EOF
			strTo= rst.Fields("EMAIL").Value
			strFrom= "office@growmetry.com"
			strSubject= "GROWMETY Contact us message from:  " & oParams("name") & " " & oParams("surname") & " - " & oParams("subject")
			strBody="Sent: " & Now() & vbCrLf & _
					"Message type: " & oParams("TypeOfMessage2") & vbCrLf & _
					"Message sender: " & oParams("salutation2") & " " & oParams("name") & " " & oParams("surname") & vbCrLf & _
					"E-mail: " & oParams("email") & vbCrLf & _
					"Country: " & oParams("countrycode2") & vbCrLf & _
					vbCrLf & _
					vbCrLf & _
					oParams("message")
'			Response.Write(strBody)
			call sendmail_now (strTo, strFrom, strSubject, strBody)
			rst.MoveNext
		Loop
		rst.Close
	end if
	
    If Err.Number Then
		Response.Write("//Errors("&Err.Number&"): " & Err.Description)
		Err.Clear
	End If
	
end if
%>
<script type="text/javascript">
    var success = "Your message sent, thank you!";

    var _errorReqFields = '<%= fc_value_string(lng_id, "var_contact_us_01") %>';
    var _errorReqFieldsAlert = '<%= fc_value_string(lng_id, "var_contact_us_02") %>';
    var _errorCommon1 = '<%= fc_value_string(lng_id, "var_contact_us_03") %>';
    var _errorCommon2 = '<%= fc_value_string(lng_id, "var_contact_us_04") %>';
    var _errorCommon3 = '<%= fc_value_string(lng_id, "var_contact_us_05") %>';
    
    var _errorFieldsEmpty = '<%= fc_value_string(lng_id, "var_contact_us_06") %>';
    
    var _lngValidEmail = '<%= fc_value_string(lng_id, "var_contact_us_07") %>';
    var _lngEmailNotValid = '<%= fc_value_string(lng_id, "var_contact_us_08") %>';
    var _lngLoginNotValid = '<%= fc_value_string(lng_id, "var_contact_us_09") %>';


    function isValidEmail(strEmail) {
        validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
        //alert(success!);     

        if (strEmail.search(validRegExp) == -1) {                                   
            return false;                    
        }
        return true;
    }
    
    function reloadCaptcha(){$("#imgCaptcha").attr('src', 'captcha.asp?' + new Date().getTime());}

    $(document).ready(function () {

        $("#user_submit").click(function () {

            var errReqField = false;
            var errList = "";
            var reqFields = Array('salutation2', 'contact_firstname', 'contact_surname', 'contact_email', 'TypeOfMessage2', 'subject', 'message');
            for (i = 0; i < reqFields.length; i++) {
                if ($("#" + reqFields[i]).val() == "") {
                    $("#" + reqFields[i]).addClass("inputrequired");
                    $("#lbl_" + reqFields[i]).addClass("required");
                    errReqField = true;
                }
            }

            if (errReqField) {
                errList = errList + _errorReqFields;
            }

            //check email for valid input
            if ($("#contact_email").val() != "") {
                if (!isValidEmail($("#contact_email").val())) {
                    $("#contact_email").addClass("inputrequired");
                    $("#lbl_user_contact_email").addClass("required");
                    errReqField = true;
                    errList = errList + _lngValidEmail + "<br/>";
                }
            }

            if (errReqField) {
                $("#reqErrorList").html(errList);

                $('html, body').animate({
                    scrollTop: $("#reqErrorList").offset().top
                }, 1000);

                return false;
            }
    
            //                    $("#reqSuccess").html(success);
            //                    $('html, body').animate({
            //                        scrollTop: $("#reqSuccess").offset().top
            //                    }, 1000);


            return true;
            // return false; 

        });
    });

</script>
<form id="form1" action="" method="POST">
    <input type="hidden" name="action" value="send" />
    <div id="page" class="container_12">

        <div id="main-content">
            <div class="clearall grid_12 height35">&nbsp;</div>

            <div class="promo">
                <div class="grid_8">
                    <h3 class="royal_blue"><%= fc_value_string(lng_id, "var_contact_us_10") %></h3>
                    <!--p class="p2">We would love to hear from you! Please fill out this form and we will get in touch with you shortly.</p-->
                    <p class="p2"><%= fc_value_string(lng_id, "var_contact_us_11") %></p>
                    <span id="reqSuccess" class="required blue">&nbsp;</span>
                    <span id="reqErrorList" class="required blue">&nbsp;</span>
                    <div class="textbox feedback">
                        <p>
                            <label for='salutation2'><%= fc_value_string(lng_id, "var_contact_us_16") %>: <span class="red">*</span></label>
                            <select name="salutation2" class="fielddata" id="salutation2">
                                <option value="" selected="">Please select.....</option>
                                <option value="Mr.">Mr.</option>
                                <option value="Ms.">Ms.</option>
                                <option value="Miss">Miss</option>
                                <option value="Mrs.">Mrs.</option>
                            </select>
                        </p>
                        <p>
                            <label for='contact_firstname'><%= fc_value_string(lng_id, "var_contact_us_12") %>: <span class="red">*</span></label>
                            <input type="text" name="name" value="" id="contact_firstname" />
                        </p>
                        <p>
                            <label for='contact_surname'><%= fc_value_string(lng_id, "var_contact_us_13") %>: <span class="red">*</span></label>
                            <input type="text" name="surname" value="" id="contact_surname" />
                        </p>
                        <p>
                            <label for='contact_email'><%= fc_value_string(lng_id, "var_contact_us_14") %>: <span class="red">*</span></label>
                            <input type="text" name="email" value="" id="contact_email" />
                        </p>
                        <p>
                            <label for='organization'><%= fc_value_string(lng_id, "var_contact_us_17") %>:</label>
                            <input type="text" name="organization" value="" id="organization" />
                        </p>
                        <p>
                            <label for='countrycode2'><%= fc_value_string(lng_id, "var_contact_us_18") %>: <span class="red">*</span></label>
                            <select name="countrycode2" id="countrycode2" class="fielddata">
                                <option value="" selected="selected">Please select...</option>
                                <option value="AF">Afghanistan</option>
                                <option value="AL">Albania</option>
                                <option value="DZ">Algeria</option>
                                <option value="AS">American Samoa</option>
                                <option value="AD">Andorra</option>
                                <option value="AO">Angola</option>
                                <option value="AI">Anguilla</option>
                                <option value="AQ">Antarctica</option>
                                <option value="AG">Antigua, Barbuda</option>
                                <option value="AR">Argentina</option>
                                <option value="AM">Armenia</option>
                                <option value="AW">Aruba</option>
                                <option value="AU">Australia</option>
                                <option value="AT">Austria</option>
                                <option value="AZ">Azerbaijan</option>
                                <option value="BS">Bahamas</option>
                                <option value="BH">Bahrain</option>
                                <option value="BD">Bangladesh</option>
                                <option value="BB">Barbados</option>
                                <option value="BY">Belarus</option>
                                <option value="BE">Belgium</option>
                                <option value="BZ">Belize</option>
                                <option value="BJ">Benin</option>
                                <option value="BM">Bermuda</option>
                                <option value="BT">Bhutan</option>
                                <option value="BO">Bolivia</option>
                                <option value="BA">Bosnia, Herzegovina</option>
                                <option value="BW">Botswana</option>
                                <option value="BV">Bouvet Is.</option>
                                <option value="BR">Brazil</option>
                                <option value="BN">Brunei Darussalam</option>
                                <option value="BG">Bulgaria</option>
                                <option value="BF">Burkina Faso</option>
                                <option value="BI">Burundi</option>
                                <option value="KH">Cambodia</option>
                                <option value="CM">Cameroon</option>
                                <option value="CA">Canada</option>
                                <option value="CV">Cape Verde</option>
                                <option value="KY">Cayman Is.</option>
                                <option value="CF">Central African Rep.</option>
                                <option value="TD">Chad</option>
                                <option value="CL">Chile</option>
                                <option value="CN">China</option>
                                <option value="CX">Christmas Is.</option>
                                <option value="CC">Cocos Is.</option>
                                <option value="CO">Colombia</option>
                                <option value="KM">Comoros</option>
                                <option value="CG">Congo</option>
                                <option value="CD">Congo, D.R. Of</option>
                                <option value="CK">Cook Is.</option>
                                <option value="CR">Costa Rica</option>
                                <option value="HR">Croatia</option>
                                <option value="CY">Cyprus</option>
                                <option value="CZ">Czech Republic</option>
                                <option value="DK">Denmark</option>
                                <option value="DJ">Djibouti</option>
                                <option value="DM">Dominica</option>
                                <option value="DO">Dominican Republic</option>
                                <option value="EC">Ecuador</option>
                                <option value="EG">Egypt</option>
                                <option value="SV">El Salvador</option>
                                <option value="GQ">Equatorial Guinea</option>
                                <option value="ER">Eritrea</option>
                                <option value="EE">Estonia</option>
                                <option value="ET">Ethiopia</option>
                                <option value="FK">Falkland Is.</option>
                                <option value="FO">Faroe Is.</option>
                                <option value="FJ">Fiji</option>
                                <option value="FI">Finland</option>
                                <option value="FR">France</option>
                                <option value="FX">France Metropolitan</option>
                                <option value="GF">French Guiana</option>
                                <option value="PF">French Polynesia</option>
                                <option value="TF">French Territories</option>
                                <option value="GA">Gabon</option>
                                <option value="GM">Gambia</option>
                                <option value="GE">Georgia</option>
                                <option value="DE">Germany</option>
                                <option value="GH">Ghana</option>
                                <option value="GI">Gibraltar</option>
                                <option value="GR">Greece</option>
                                <option value="GL">Greenland</option>
                                <option value="GD">Grenada</option>
                                <option value="GP">Guadeloupe</option>
                                <option value="GU">Guam</option>
                                <option value="GT">Guatemala</option>
                                <option value="GN">Guinea</option>
                                <option value="GW">Guinea-bissau</option>
                                <option value="GY">Guyana</option>
                                <option value="HT">Haiti</option>
                                <option value="HM">Heard, Mcdonald Is.</option>
                                <option value="HN">Honduras</option>
                                <option value="HK">Hong Kong</option>
                                <option value="HU">Hungary</option>
                                <option value="IS">Iceland</option>
                                <option value="IN">India</option>
                                <option value="ID">Indonesia</option>
                                <option value="IE">Ireland</option>
                                <option value="IL">Israel</option>
                                <option value="IT">Italy</option>
                                <option value="JM">Jamaica</option>
                                <option value="JP">Japan</option>
                                <option value="JO">Jordan</option>
                                <option value="KZ">Kazakhstan</option>
                                <option value="KE">Kenya</option>
                                <option value="KI">Kiribati</option>
                                <option value="KR">Korea South</option>
                                <option value="KD">Korea, D.P.R Of</option>
                                <option value="KW">Kuwait</option>
                                <option value="KG">Kyrgyzstan</option>
                                <option value="LV">Latvia</option>
                                <option value="LB">Lebanon</option>
                                <option value="LS">Lesotho</option>
                                <option value="LR">Liberia</option>
                                <option value="LI">Liechtenstein</option>
                                <option value="LT">Lithuania</option>
                                <option value="LU">Luxembourg</option>
                                <option value="MO">Macau</option>
                                <option value="MK">Macedonia, F.Y.R Of</option>
                                <option value="MG">Madagascar</option>
                                <option value="MW">Malawi</option>
                                <option value="MY">Malaysia</option>
                                <option value="MV">Maldives</option>
                                <option value="ML">Mali</option>
                                <option value="MT">Malta</option>
                                <option value="MH">Marshall Islands</option>
                                <option value="MQ">Martinique</option>
                                <option value="MR">Mauritania</option>
                                <option value="MU">Mauritius</option>
                                <option value="YT">Mayotte</option>
                                <option value="MX">Mexico</option>
                                <option value="FM">Micronesia</option>
                                <option value="MD">Moldova</option>
                                <option value="MC">Monaco</option>
                                <option value="MN">Mongolia</option>
                                <option value="MS">Montserrat</option>
                                <option value="MA">Morocco</option>
                                <option value="MZ">Mozambique</option>
                                <option value="MM">Myanmar</option>
                                <option value="NA">Namibia</option>
                                <option value="NR">Nauru</option>
                                <option value="NP">Nepal</option>
                                <option value="NL">Netherlands</option>
                                <option value="AN">Netherlands Antilles</option>
                                <option value="NC">New Caledonia</option>
                                <option value="NZ">New Zealand</option>
                                <option value="NI">Nicaragua</option>
                                <option value="NE">Niger</option>
                                <option value="NG">Nigeria</option>
                                <option value="NU">Niue</option>
                                <option value="NF">Norfolk Island</option>
                                <option value="NO">Norway</option>
                                <option value="OM">Oman</option>
                                <option value="PK">Pakistan</option>
                                <option value="PW">Palau</option>
                                <option value="PA">Panama</option>
                                <option value="PG">Papua New Guinea</option>
                                <option value="PY">Paraguay</option>
                                <option value="PE">Peru</option>
                                <option value="PH">Philippines</option>
                                <option value="PN">Pitcairn</option>
                                <option value="PL">Poland</option>
                                <option value="PT">Portugal</option>
                                <option value="PR">Puerto Rico</option>
                                <option value="QA">Qatar</option>
                                <option value="RE">Reunion</option>
                                <option value="RO">Romania</option>
                                <option value="RU">Russian Federation</option>
                                <option value="RW">Rwanda</option>
                                <option value="WS">Samoa</option>
                                <option value="SM">San Marino</option>
                                <option value="ST">Sao Tome, Principe</option>
                                <option value="SA">Saudi Arabia</option>
                                <option value="SN">Senegal</option>
                                <option value="SC">Seychelles</option>
                                <option value="SL">Sierra Leone</option>
                                <option value="SG">Singapore</option>
                                <option value="SK">Slovakia</option>
                                <option value="SI">Slovenia</option>
                                <option value="SB">Solomon Is.</option>
                                <option value="SO">Somalia</option>
                                <option value="ZA">South Africa</option>
                                <option value="GS">South Georgia</option>
                                <option value="ES">Spain</option>
                                <option value="LK">Sri Lanka</option>
                                <option value="SH">St. Helena</option>
                                <option value="KN">St. Kitts, Nevis</option>
                                <option value="LC">St. Lucia</option>
                                <option value="PM">St. Pierre, Miquelon</option>
                                <option value="SR">Suriname</option>
                                <option value="SZ">Swaziland</option>
                                <option value="SE">Sweden</option>
                                <option value="CH">Switzerland</option>
                                <option value="SY">Syrian Arab Republic</option>
                                <option value="TW">Taiwan</option>
                                <option value="TJ">Tajikistan</option>
                                <option value="TZ">Tanzania</option>
                                <option value="TH">Thailand</option>
                                <option value="TG">Togo</option>
                                <option value="TK">Tokelau</option>
                                <option value="TO">Tonga</option>
                                <option value="TT">Trinidad, Tobago</option>
                                <option value="TN">Tunisia</option>
                                <option value="TR">Turkey</option>
                                <option value="TM">Turkmenistan</option>
                                <option value="TC">Turks, Caicoss</option>
                                <option value="TV">Tuvalu</option>
                                <option value="UG">Uganda</option>
                                <option value="UA">Ukraine</option>
                                <option value="AE">United Arab Emirates</option>
                                <option value="GB">United Kingdom</option>
                                <option value="US">United States</option>
                                <option value="UY">Uruguay</option>
                                <option value="UZ">Uzbekistan</option>
                                <option value="VU">Vanuatu</option>
                                <option value="VA">Vatican City</option>
                                <option value="VE">Venezuela</option>
                                <option value="VN">Vietnam</option>
                                <option value="VG">Virgin Is. British</option>
                                <option value="VI">Virgin Is. U.S.</option>
                                <option value="WF">Wallis, Futuna</option>
                                <option value="EH">Western Sahara</option>
                                <option value="YE">Yemen</option>
                                <option value="YU">Yugoslavia</option>
                                <option value="ZM">Zambia</option>
                            </select>
                        </p>
                        <p>
                            <label for='TypeOfMessage2'><%= fc_value_string(lng_id, "var_contact_us_19") %>: <span class="red">*</span></label>
                            <select name="TypeOfMessage2" class="fielddata" id="TypeOfMessage2">
                                <option selected="" value="">Please select.....</option>
                                <option value="General">General</option>
                                <option value="Technical Support">Technical Support</option>
                                <option value="Suggestions">Suggestions</option>
                            </select>
                        </p>
                        <p>
                            <label for='subject'><%= fc_value_string(lng_id, "var_contact_us_20") %>: <span class="red">*</span></label>
                            <input type="text" name="subject" value="" id="subject" />
                        </p>
                        <p>
                            <label for='message'><%= fc_value_string(lng_id, "var_contact_us_21") %>: <span class="red">*</span></label>
                            <textarea name="message" rows="6" cols="30" id="message"></textarea>
                        </p>
                        <!--UC:CAPTCHA id="cxCaptcha" runat="server" height="60" width="130" textLength="6" /-->
                        <table cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td width="150">
                                        <img id="imgCaptcha" src="captcha.asp" />
                                    </td>                                                
                                </tr>
                                <tr>
                                    <td style="height:5px;" colspan="2"></td>
                                </tr>
                                <tr>
                                    <td>
                                        <span id="cxCaptcha_lbEnterCode" class="LoginLabel captchaspan"><%= fc_value_string(lng_id, "var_contact_us_22") %>
                                            <!--If you're not sure what the code is, just hit "Refresh" in your browser to receive a new code.--></span>
                                    </td>
                                    <td width="150">
                                        <input name="cxCaptcha_edCaptcha" type="text" id="cxCaptcha_edCaptcha" style="width:150px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="height:5px;" colspan="2"></td>
                                </tr>
                                <tr>
                                    <td>
                                        <span id="cxCaptcha_lbCannotRead" class="captchaspan"><%= fc_value_string(lng_id, "var_contact_us_23") %></span>
                                    </td>
                                    <td>
                                        <a class="captchaspan blue bold" id="cxCaptcha_btnTryDifferent" href="javascript: reloadCaptcha();"><%= fc_value_string(lng_id, "var_contact_us_24") %></a> 	    
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <p class="p2"><%= fc_value_string(lng_id, "var_contact_us_25") %></p>
                        <label></label>
                        <button class="submit buttonreset" type="button" value="Reset Form" onClick="this.form.reset()"><%= fc_value_string(lng_id, "var_contact_us_26") %></button>
                        <button class="submit buttonsubmit" type="submit" id="user_submit"><%= fc_value_string(lng_id, "var_contact_us_27") %></button>
                    </div>
                    <span id="thanx" class="blue"></span>
                </div>

                <div class="grid_4">
                    <h3 class="royal_blue"><%= fc_value_string(lng_id, "var_contact_us_28") %></h3>
                    <div class="icon64_wrap">
                        <%= fc_get_rotated_images_code("contact_us.asp", "picture_location_1", false) %>
<!--                        <img src="images/icon_contact64.jpg" alt="contact Growmetry" />-->
                    </div>
                    <p><%= fc_value_string(lng_id, "var_contact_us_29") %></p>
                    <p class="p00"><%= fc_value_string(lng_id, "var_contact_us_30") %></p>
                    <p><%= fc_value_string(lng_id, "var_contact_us_31") %></p>
                    <p><span class="red"><img src="images/list_arrow.gif" alt="check" />&nbsp;&nbsp;</span><a href="#"><%= fc_value_string(lng_id, "var_contact_us_32") %></a></p>                            
                </div>                                              
            </div>

            <div class="clear line"></div>              

        </div>
    </div>
    <!--#include file="_footer.html"-->
</form> 
</body>
</html>